<?php
namespace App\Http\Controllers\Admin;
use App\Model\HotelReferral;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Cache;
use Carbon;
use App\Http\Requests;
use DB;

class IndexController extends Controller
{

    public function __construct()
    {
        parent::__construct();
        view()->share([
            '_index' => 'am-active',
        ]);
    }



    function index()
    {

        $os = PHP_OS;
        $server_software = $_SERVER["SERVER_SOFTWARE"];
        $php = php_sapi_name();
        $total_space2 = round((@disk_total_space(".") / (1024 * 1024)));
        $total_space = $total_space2 / 1000;
        $free_space2 = round((@disk_free_space(".") / (1024 * 1024)));
        $free_space = $free_space2 / 1000;
        $already_used_percent = round(($total_space2 - $free_space2) / $total_space2 * 100);
        return view('Admin.xHotel.index')->with([
            'total_space' => $total_space,
            'free_space' => $free_space,
            'already_used_percent' => $already_used_percent,
            'os' => $os,
            'server_software' => $server_software,
            'php' => $php,
        ]);
    }

    /**
     * 清除所有的缓存
     * @return mixed
     */
    function clear_cache()
    {
        Cache::flush();
        return back()->with('success', '缓存清除成功~');
    }

}